#include <stdio.h>
#include "U1_uart.h"
#include "U0_uart.h"
#include "esp_log.h"

static const char *TAG = "MAIN";

void app_main(void)
{
    ESP_LOGI(TAG, "Initializing UARTs...");
    ESP_LOGI(TAG, "Initializing UART0...");
    uart_init();
    ESP_LOGI(TAG, "UART0 initialized successfully");
    
    ESP_LOGI(TAG, "Initializing UART1...");
    uart1_init();
    ESP_LOGI(TAG, "UART1 initialized successfully");
    
    ESP_LOGI(TAG, "All UARTs initialization completed");
    
    // 示例：向UART1发送测试数据
    // 使用字节数组替代字符串
    unsigned char uart1_data[] = {0x48, 0x65, 0x6C, 0x6C, 0x6F};  // "Hello"的ASCII码
    size_t uart1_data_len = sizeof(uart1_data) / sizeof(uart1_data[0]);
    uart1_send_data((const char *)uart1_data, uart1_data_len);

    // 使用字节数组替代字符串
    unsigned char uart0_data[] = {0x48, 0x65, 0x6C, 0x6C, 0x6F};  // "Hello"的ASCII码
    size_t uart0_data_len = sizeof(uart0_data) / sizeof(uart0_data[0]);
    uart_send_data((const char *)uart0_data, uart0_data_len);
    ESP_LOGI(TAG, "Sent test message to UART0");
}